<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">退款记录</h4>
</div>
<div class="wrapper" ng-controller="ordersRefundCtrl">
    <div class="panel panel-default padder-v padder-md">
        <div class="clearfix m-b-sm">
            <form class="form-inline">
                <div class="block m-t-sm">
                    <label class="control-label">查询时间</label>
                    <div class="input-group inline" ng-controller="DatepickerDemoCtrl">
                        <div class="input-group  no-padder m-n w-lg">
                            <input type="text" class="input-sm form-control" placeholder="请输入开始日期" uib-datepicker-popup="yyyy-MM-dd" datepicker-popup="yyyy-MM-dd" ng-model="ordersRefund.startTime"
                                   alt-input-formats="altInputFormats" is-open="opened" datepicker-options="dateOptions" close-text="关闭" clear-text="清空" current-text="今天" disabled/>
                                <span class="input-group-btn ">
                                    <button type="button" class="input-sm btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                                </span>
                        </div>
                    </div>
                    <div class="input-group inline" ng-controller="DatepickerDemoCtrl">
                        <div class="input-group  no-padder m-n w-lg">
                            <input type="text" class="input-sm form-control" placeholder="请输入结束日期" uib-datepicker-popup="yyyy-MM-dd" datepicker-popup="yyyy-MM-dd" ng-model="ordersRefund.endTime"
                                   alt-input-formats="altInputFormats" is-open="opened" datepicker-options="dateOptions" close-text="关闭" clear-text="清空" current-text="今天" min-date="ordersRefund.startTime" disabled/>
                                <span class="input-group-btn ">
                                    <button type="button" class="input-sm btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                                </span>
                        </div>
                    </div>
                </div>
                <div class="form-group block m-t-sm">
                    <div class="form-group inline">
                        <label class="control-label">订单编号</label>
                        <input type="text inline" ng-model="ordersRefund.orderNumber" class="input-sm form-control">
                    </div>
                    <div class="form-group inline">
                        <label class="control-label">申请人</label>
                        <input type="text inline" ng-model="ordersRefund.nickName" class="input-sm form-control">
                    </div>
                    <div class="form-group inline">
                        <label class="control-label">状态</label>
                        <select class="input-sm form-control" ng-model="ordersRefund.status">
                            <option  value="">－－请选择－－</option>
                            <option  value="0">申请退款</option>
                            <option  value="1">平台审核中</option>
                            <option  value="2">商家拒绝</option>
                            <option  value="3">退款中</option>
                            <option  value="4">平台拒绝</option>
                            <option  value="5">退款完成</option>
                        </select>
                    </div>
                </div>
                <button class="btn btn-md btn-default" ng-click="query()">查询</button>
            </form>
        </div>
        <div class="fa-border">
            <table class="table m-b-none table-striped table-responsive">
                <thead>
                    <tr>
                        <th>申请人信息</th>
                        <th>退款编号</th>
                        <th>订单信息</th>
                        <th>退款商品信息</th>
                        <th>退款金额</th>
                        <th>退款原因</th>
                        <th>状态</th>
                        <th>操作时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="item in list">
                        <td>
                            <label ng-if="item.type == 0">
                                <span>昵称：{{item.nickName}}<br></span>
                                <span>联系方式：{{item.mobilePhone}}</span>
                            </label>
                            <label ng-if="item.type == 1">
                                <span>店名：{{item.shopName}}<br></span>
                                <span>联系方式：{{item.shopPhone}}</span>
                            </label>
                        </td>
                        <td>
                            {{item.refundNumber}}
                        </td>
                        <td>
                            <span>订单编号：{{item.orderNumber}}<br></span>
                            <span>优惠金额：{{item.couponsMoney | number:2}} 元<br></span>
                            <span>配送费：{{item.postage | number:2}} 元<br></span>
                            <span>支付金额：{{item.payMoney | number:2}} 元</span>
                        </td>
                        <td>
                            <span>商品名称：{{item.goodsName}}<br></span>
                            <span>商品单价：{{item.price | number:2}} 元<br></span>
                            <span ng-if="item.skuContentName != null">规格属性：{{item.skuContentName}}<br></span>
                            <span ng-if="item.skuContentName == null">规格属性：未开启<br></span>
                            <span>购买数量：{{item.number}}</span>
                        </td>
                        <td>{{item.money | number:2}} 元</td>
                        <td>{{item.reason}}</td>
                        <td>
                            <span class="label bg-info" ng-if='item.status==0'>申请中</span>
                            <span class="label bg-warning" ng-if='item.status==1'>平台审核中</span>
                            <span class="label bg-danger" ng-if='item.status==2'>商家拒绝</span>
                            <i class="m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top"
                               popover="拒绝原因：{{item.failReason}}" popover-trigger="mouseenter" ng-if="item.status==2"></i>
                            <span class="label bg-success" ng-if='item.status==3'>退款中</span>
                            <span class="label bg-danger" ng-if='item.status==4'>平台拒绝</span>
                            <i class="m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top"
                               popover="拒绝原因：{{item.failReason}}" popover-trigger="mouseenter" ng-if="item.status==4"></i>
                            <span class="label bg-success" ng-if='item.status==5'>退款完成</span>
                        </td>
                        <td>
                            <span ng-if="item.createdTime != null">申请时间：{{item.createdTime}}<br></span>
                            <span ng-if="item.shopDealTime != null">商家处理时间：{{item.shopDealTime}}<br></span>
                            <span ng-if="item.platformTime != null">平台处理时间：{{item.platformTime}}<br></span>
                            <span ng-if="item.completeTime != null">完成时间：{{item.completeTime}}</span>
                        </td>
                        <td class="t-btns text-left">
                            <button class="btn btn-sm btn-info" ng-click="updateStatus(item.id,1)" ng-if="item.status==0">同意</button>
                            <button class="btn btn-sm btn-danger" ui-sref="app.ordersRefundFail({id:item.id})" ng-if="item.status==0">拒绝</button>
                        </td>
                    </tr>
                </tbody>
            </table>
            <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                <span class="h6">~未搜索到任何数据~</span>
            </div>
            <div>
                <circle-loading ng-if="app.loading"></circle-loading>
            </div>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">
                </div>
                <div class="col-sm-4 text-center">
                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                previous-text="上一页" next-text="下一页"
                                first-text="首页" last-text="尾页"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>